package net.xdclass.onlinexdclass.utils;

import java.security.MessageDigest;

public class CommonUtils {

    /**
     * MD5加密工具类
     */
    public static String MD5(String data) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            byte[] array = messageDigest.digest(data.getBytes("UTF-8"));
            StringBuilder stringBuilder = new StringBuilder();
            for (byte item : array) {
                stringBuilder.append(Integer.toHexString(item & 0xFF | 0x100).substring(1, 3));
            }
            return stringBuilder.toString().toUpperCase();


        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }





}
